#ifndef __RINGBUFFER_H
#define __RINGBUFFER_H

#include <stdint.h>
#include <stdbool.h>

typedef struct {
	uint8_t *buffer;
	uint32_t size;
	uint32_t len;
	uint8_t *header;
	uint8_t *tail;
}ringbuffer_t;

void ringbuffer_init(ringbuffer_t *rb, uint8_t *buffer, uint32_t size);

uint32_t ringbuffer_push(ringbuffer_t *rb, uint8_t *data, uint32_t len);

uint32_t ringbuffer_pop(ringbuffer_t *rb, uint8_t *data, uint32_t len);

bool ringbuffer_is_empty(ringbuffer_t *rb);

bool ringbuffer_is_full(ringbuffer_t *rb);

uint32_t ringbuffer_get_len(ringbuffer_t *rb);

#endif
